﻿using System;
using System.Collections.Generic;

namespace Miao.ML
{
	public abstract class WinMLData
	{
		public abstract DataType type { get; }

		public static WinMLData CreateDataByType(DataType dataType)
		{
			return dataType switch
			{
				DataType.Int => new IntData(), 
				DataType.Bool => new BoolData(), 
				DataType.Long => new LongData(), 
				DataType.List => new ListData(), 
				DataType.Float => new FloatData(), 
				DataType.Custom => new CustomData(), 
				DataType.String => new StringData(), 
				DataType.Double => new DoubleData(), 
				DataType.Object => new ObjectData(), 
				DataType.Reference => new ReferenceData(), 
				DataType.Dictionary => new DictionaryData(), 
				DataType.GenericArgument => new GenericArgumentData(), 
				_ => throw new NotImplementedException(), 
			};
		}

		public virtual void SetValueByText(string text)
		{
			throw new NotSupportedException();
		}

		public virtual IEnumerable<WinMLData> GetSubData()
		{
			yield break;
		}
	}
}
